{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 公众号：早起Python"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "import re\n",
    "from bs4 import BeautifulSoup\n",
    "import time\n",
    "import datetime\n",
    "import random\n",
    "import pandas as pd\n",
    "from urllib import request, parse\n",
    "import warnings\n",
    "import json\n",
    "warnings.filterwarnings(\"ignore\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 爬取天气相关代码"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 下面为杭州天气，更换城市请自行修改天气网对应url"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "r = requests.get('https://www.tianqi.com/hangzhou/')\n",
    "soup = BeautifulSoup(r.text)\n",
    "\n",
    "date = soup.find_all('dd',class_ = 'week')[0].text.strip()\n",
    "date = re.sub(u'\\u3000', \"，\", date)\n",
    "time_now = time.strftime(\"%H:%M:%S\", time.localtime()) \n",
    "\n",
    "weather =soup.select('dd > span')[0].text\n",
    "\n",
    "air = soup.select('dd > h5')[0].text\n",
    "\n",
    "time1 = datetime.datetime.strptime(time_now,\"%H:%M:%S\")\n",
    "time2 = datetime.datetime.strptime('9:30:00',\"%H:%M:%S\")\n",
    "time3 = round((time2 - time1).total_seconds() / 60)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2021年02月13日，星期六，辛丑年正月初二\n",
      "07:52:42\n",
      "阴8 ~ 16℃\n",
      "空气质量：优\n"
     ]
    }
   ],
   "source": [
    "print(date)\n",
    "print(time_now)\n",
    "print(weather)\n",
    "print(air)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 交通相关"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 请务必按照原文中的方式在百度地图开放平台申请一个AK后方能执行下面代码！！！！！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "AK = \"替换为你申请的AK\" \n",
    "\n",
    "def get_position(name,AK):\n",
    "    url = f'http://api.map.baidu.com/geocoding/v3/?address={name}&output=json&ak={AK}'\n",
    "    res = requests.get(url)\n",
    "    val = res.json()\n",
    "    retval = {'地址':name,'经度':val['result']['location']['lng'],'纬度':val['result']['location']['lat'],'地区标签':val['result']['level'],'是否精确查找':val['result']['precise']}\n",
    "    longitude = retval['经度']\n",
    "    latitude = retval['纬度']\n",
    "\n",
    "    return(longitude,latitude)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(120.11614538041329, 30.294761455511946)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_position('杭州市益乐新村',AK)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 复制上面的经纬度构造URL"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 1、驾车信息相关"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "url = f'http://api.map.baidu.com/directionlite/v1/driving?origin=40.01116,116.339303&destination=39.936404,116.452562&ak={AK}'\n",
    "data = requests.get(url)\n",
    "data = data.content.decode('unicode_escape')\n",
    "data = json.loads(data)\n",
    "\n",
    "distance = data['result']['routes'][0]['distance']/1000 #驾车距离\n",
    "time_cost = round(data['result']['routes'][0]['duration']/60) #驾车耗时\n",
    "\n",
    "lukuang = data['result']['routes'][0]['traffic_condition']\n",
    "lukuang = '畅通' if lukuang == 1 else '缓行' if lukuang == 2 else '拥堵' if lukuang == 3 else '严重拥堵' #路况"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': 0,\n",
       " 'message': 'ok',\n",
       " 'result': {'origin': {'lng': 116.339303, 'lat': 40.011160069003},\n",
       "  'destination': {'lng': 116.452562, 'lat': 39.93640407532},\n",
       "  'routes': [{'distance': 17492,\n",
       "    'duration': 1720,\n",
       "    'traffic_condition': 1,\n",
       "    'toll': 0,\n",
       "    'steps': [{'leg_index': 0,\n",
       "      'distance': 128,\n",
       "      'duration': 10,\n",
       "      'direction': 6,\n",
       "      'turn': 7,\n",
       "      'road_type': 6,\n",
       "      'road_types': '6',\n",
       "      'instruction': '从<b>起点</b>向正南方向出发,行驶130米,<b>左转</b>',\n",
       "      'path': '116.33964557069,40.01051873416;116.33967584359,40.010168642615;116.33970647581,40.009358617237',\n",
       "      'traffic_condition': [{'status': 0, 'geo_cnt': 2}],\n",
       "      'start_location': {'lng': '116.33964557069', 'lat': '40.01051873416'},\n",
       "      'end_location': {'lng': '116.33970647581', 'lat': '40.009358617237'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 330,\n",
       "      'duration': 32,\n",
       "      'direction': 3,\n",
       "      'turn': 3,\n",
       "      'road_type': 6,\n",
       "      'road_types': '6',\n",
       "      'instruction': '行驶330米,<b>右转</b>进入<b>荷清路</b>',\n",
       "      'path': '116.33970647581,40.009358617237;116.34007720649,40.009376232594;116.34091891875,40.009371397007;116.3418805548,40.009336649844;116.34238127029,40.009304527699;116.34249149238,40.00930411322;116.34334245719,40.009311090289;116.34351268608,40.009320554234;116.34361275732,40.009320277914',\n",
       "      'traffic_condition': [{'status': 0, 'geo_cnt': 8}],\n",
       "      'start_location': {'lng': '116.33970647581', 'lat': '40.009358617237'},\n",
       "      'end_location': {'lng': '116.34361275732', 'lat': '40.009320277914'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 374,\n",
       "      'duration': 38,\n",
       "      'direction': 6,\n",
       "      'turn': 7,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5',\n",
       "      'instruction': '沿<b>荷清路</b>行驶370米,<b>左转</b>进入<b>清华东路</b>',\n",
       "      'path': '116.34361275732,40.009320277914;116.34368390311,40.007600443365;116.34370420482,40.007050482236;116.3437447184,40.006150542489;116.34383481844,40.006060319882;116.34394495069,40.006060043549',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 5}],\n",
       "      'start_location': {'lng': '116.34361275732', 'lat': '40.009320277914'},\n",
       "      'end_location': {'lng': '116.34394495069', 'lat': '40.006060043549'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 1950,\n",
       "      'duration': 198,\n",
       "      'direction': 3,\n",
       "      'turn': 9,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5',\n",
       "      'instruction': '沿<b>清华东路</b>行驶2.0公里,<b>靠左</b>',\n",
       "      'path': '116.34394495069,40.006060043549;116.34451537469,40.006088713073;116.34480552737,40.006148193663;116.34510565124,40.006197657156;116.34522575469,40.006217483993;116.34618604328,40.006246637032;116.3465459943,40.006266532938;116.34665603672,40.006256515903;116.34691600634,40.006266602021;116.34725592514,40.006266740187;116.34775583216,40.006287119667;116.34901507682,40.006329260269;116.3495345669,40.006350537808;116.35009403157,40.006362212819;116.35055342501,40.006373818745;116.35162186958,40.006408360179;116.35194130702,40.006419897015;116.352001224,40.006420173346;116.35311907538,40.006466458832;116.35428642339,40.006504178026;116.35497461524,40.006529324144;116.35537355271,40.006552466853;116.35557297654,40.006564072747;116.35711815184,40.006607871159;116.35770618263,40.006633638982;116.35838377448,40.006650633305;116.35892176965,40.006676470194;116.35909110024,40.006688352396;116.35925054946,40.006690148543;116.35945967499,40.00669249735;116.35962900558,40.006704448632;116.35988798705,40.006707488264;116.36055524839,40.006745483653;116.36093361467,40.006760129143;116.36163052008,40.006799022575;116.3625661951,40.00684150827;116.36294438172,40.006856706399;116.36400923307,40.006911834126;116.36464595202,40.006941194113;116.36674475301,40.007033626178',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 39}],\n",
       "      'start_location': {'lng': '116.34394495069', 'lat': '40.006060043549'},\n",
       "      'end_location': {'lng': '116.36674475301', 'lat': '40.007033626178'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 425,\n",
       "      'duration': 40,\n",
       "      'direction': 3,\n",
       "      'turn': 9,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5',\n",
       "      'instruction': '继续沿<b>清华东路</b>行驶430米,<b>靠左</b>',\n",
       "      'path': '116.36674475301,40.007033626178;116.36719228882,40.007060775482;116.3675900585,40.007077286122;116.36804747566,40.007094832991;116.36819659438,40.007097319948;116.36828606561,40.007108787584;116.36846509789,40.007111758116;116.36996625623,40.007187333928;116.37123861616,40.007239629024;116.37132799755,40.00724121791;116.37142743997,40.00724294496;116.37146714508,40.00724363578;116.37170573502,40.007247918864',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 12}],\n",
       "      'start_location': {'lng': '116.36674475301', 'lat': '40.007033626178'},\n",
       "      'end_location': {'lng': '116.37170573502', 'lat': '40.007247918864'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 72,\n",
       "      'duration': 5,\n",
       "      'direction': 3,\n",
       "      'turn': 9,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5',\n",
       "      'instruction': '继续沿<b>清华东路</b>行驶70米,<b>靠左</b>',\n",
       "      'path': '116.37170573502,40.007247918864;116.37254062016,40.007282874344',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 1}],\n",
       "      'start_location': {'lng': '116.37170573502', 'lat': '40.007247918864'},\n",
       "      'end_location': {'lng': '116.37254062016', 'lat': '40.007282874344'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 320,\n",
       "      'duration': 29,\n",
       "      'direction': 2,\n",
       "      'turn': 3,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5',\n",
       "      'instruction': '继续沿<b>清华东路</b>行驶320米,<b>右转</b>进入<b>G6辅路</b>',\n",
       "      'path': '116.37254062016,40.007282874344;116.37258032527,40.007293582047;116.37281882538,40.007297865128;116.37327597305,40.007316102759;116.37354429691,40.007340972247;116.37360394439,40.007342077557;116.37412073955,40.007361489568;116.37479644496,40.00739381988;116.37590935565,40.007454266468;116.37626715074,40.007460829237',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 9}],\n",
       "      'start_location': {'lng': '116.37254062016', 'lat': '40.007282874344'},\n",
       "      'end_location': {'lng': '116.37626715074', 'lat': '40.007460829237'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 353,\n",
       "      'duration': 35,\n",
       "      'direction': 5,\n",
       "      'turn': 9,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '沿<b>G6辅路</b>行驶350米,<b>靠左</b>',\n",
       "      'path': '116.37626715074,40.007460829237;116.37665494923,40.006998048829;116.37666492042,40.00697822222;116.37742057501,40.006022324108;116.37782831589,40.005489897448;116.37837520428,40.004769971468',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 5}],\n",
       "      'start_location': {'lng': '116.37626715074', 'lat': '40.007460829237'},\n",
       "      'end_location': {'lng': '116.37837520428', 'lat': '40.004769971468'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 47,\n",
       "      'duration': 2,\n",
       "      'direction': 4,\n",
       "      'turn': 1,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '行驶50米,<b>直行</b>进入<b>京藏高速</b>',\n",
       "      'path': '116.37837520428,40.004769971468;116.37878276549,40.004497501565',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 1}],\n",
       "      'start_location': {'lng': '116.37837520428', 'lat': '40.004769971468'},\n",
       "      'end_location': {'lng': '116.37878276549', 'lat': '40.004497501565'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 411,\n",
       "      'duration': 40,\n",
       "      'direction': 5,\n",
       "      'turn': 9,\n",
       "      'road_type': 0,\n",
       "      'road_types': '0',\n",
       "      'instruction': '沿<b>京藏高速</b>行驶410米,朝<b>北四环,亚运村,中关村方向</b>,<b>靠左</b>',\n",
       "      'path': '116.37878276549,40.004497501565;116.38005548474,40.002870811329;116.38122867173,40.00136208443',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 2}],\n",
       "      'start_location': {'lng': '116.37878276549', 'lat': '40.004497501565'},\n",
       "      'end_location': {'lng': '116.38122867173', 'lat': '40.00136208443'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 496,\n",
       "      'duration': 48,\n",
       "      'direction': 5,\n",
       "      'turn': 9,\n",
       "      'road_type': 0,\n",
       "      'road_types': '0',\n",
       "      'instruction': '继续沿<b>京藏高速</b>行驶500米,朝<b>北三环,马甸桥,G6,京藏高速方向</b>,<b>靠左</b>',\n",
       "      'path': '116.38122867173,40.00136208443;116.38148720406,40.001036679178;116.38274986228,39.99939898961;116.38327689813,39.998578195436;116.38346581177,39.998191423825;116.38363487287,39.997784337065;116.38376413903,39.99741656123',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 6}],\n",
       "      'start_location': {'lng': '116.38122867173', 'lat': '40.00136208443'},\n",
       "      'end_location': {'lng': '116.38376413903', 'lat': '39.99741656123'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 736,\n",
       "      'duration': 73,\n",
       "      'direction': 5,\n",
       "      'turn': 9,\n",
       "      'road_type': 0,\n",
       "      'road_types': '0',\n",
       "      'instruction': '继续沿<b>京藏高速</b>行驶740米,朝<b>北三环,G6,京藏高速,G110方向</b>,<b>靠左</b>',\n",
       "      'path': '116.38376413903,39.99741656123;116.38416181888,39.996093366997;116.3846887649,39.99434217287;116.38506641253,39.993058372687;116.38538441268,39.991903553605;116.38554332293,39.991336121378;116.38564267552,39.990987727244',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 6}],\n",
       "      'start_location': {'lng': '116.38376413903', 'lat': '39.99741656123'},\n",
       "      'end_location': {'lng': '116.38564267552', 'lat': '39.990987727244'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 1608,\n",
       "      'duration': 163,\n",
       "      'direction': 5,\n",
       "      'turn': 9,\n",
       "      'road_type': 0,\n",
       "      'road_types': '0',\n",
       "      'instruction': '继续沿<b>京藏高速</b>行驶1.6公里,朝<b>北二环,德胜门桥方向</b>,<b>靠左</b>',\n",
       "      'path': '116.38564267552,39.990987727244;116.38605993843,39.989594340098;116.38677507944,39.987085410908;116.3870034287,39.986268890178;116.387053105,39.98607961573;116.38728145426,39.985263013779;116.38735089327,39.98501409922;116.38743030348,39.984725241089;116.38747997978,39.984545982578;116.38752956624,39.984336731873;116.38754941879,39.984237012766;116.38766844427,39.983628674663;116.38767832563,39.983518795905;116.38771794091,39.983169324985;116.38771749175,39.98257922159;116.38771740192,39.982429189799;116.3877073409,39.982279019461;116.38769736971,39.982168862085;116.38761724086,39.981347444537;116.38754717303,39.980776192038;116.38745716282,39.980034648527;116.38732699835,39.978932339128;116.38722683728,39.978100584717;116.38719683388,39.977830080917;116.38706657958,39.976727735672',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 24}],\n",
       "      'start_location': {'lng': '116.38564267552', 'lat': '39.990987727244'},\n",
       "      'end_location': {'lng': '116.38706657958', 'lat': '39.976727735672'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 186,\n",
       "      'duration': 16,\n",
       "      'direction': 6,\n",
       "      'turn': 1,\n",
       "      'road_type': 0,\n",
       "      'road_types': '0',\n",
       "      'instruction': '继续沿<b>京藏高速</b>行驶190米,<b>直行</b>进入<b>G110</b>',\n",
       "      'path': '116.38706657958,39.976727735672;116.38687631847,39.975204327244;116.38685628626,39.975063955205',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 2}],\n",
       "      'start_location': {'lng': '116.38706657958', 'lat': '39.976727735672'},\n",
       "      'end_location': {'lng': '116.38685628626', 'lat': '39.975063955205'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 361,\n",
       "      'duration': 35,\n",
       "      'direction': 6,\n",
       "      'turn': 1,\n",
       "      'road_type': 1,\n",
       "      'road_types': '0,1',\n",
       "      'instruction': '沿<b>G110</b>行驶360米,<b>直行</b>进入<b>德胜门外大街</b>',\n",
       "      'path': '116.38685628626,39.975063955205;116.38683616422,39.974873612744;116.386816132,39.974673248045;116.38677597775,39.97429249128;116.38674588451,39.973991906874;116.38671588111,39.973791401336;116.38667581668,39.973460679945;116.38666575566,39.97332044253;116.38665569464,39.973240267238;116.38662560141,39.972999740795;116.38658553698,39.972669015543;116.38651537932,39.972047648585;116.38648528609,39.97181714004',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 12}],\n",
       "      'start_location': {'lng': '116.38685628626', 'lat': '39.975063955205'},\n",
       "      'end_location': {'lng': '116.38648528609', 'lat': '39.97181714004'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 171,\n",
       "      'duration': 16,\n",
       "      'direction': 6,\n",
       "      'turn': 9,\n",
       "      'road_type': 1,\n",
       "      'road_types': '1',\n",
       "      'instruction': '沿<b>德胜门外大街</b>行驶170米,朝<b>二环路,德胜门桥,G110方向</b>,<b>靠左</b>',\n",
       "      'path': '116.38648528609,39.97181714004;116.38643516064,39.971376164987;116.38629484532,39.970283598926',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 2}],\n",
       "      'start_location': {'lng': '116.38648528609', 'lat': '39.97181714004'},\n",
       "      'end_location': {'lng': '116.38629484532', 'lat': '39.970283598926'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 330,\n",
       "      'duration': 32,\n",
       "      'direction': 6,\n",
       "      'turn': 9,\n",
       "      'road_type': 1,\n",
       "      'road_types': '1',\n",
       "      'instruction': '继续沿<b>德胜门外大街</b>行驶330米,朝<b>二环路,德胜门桥,G110方向</b>,<b>靠左</b>',\n",
       "      'path': '116.38629484532,39.970283598926;116.38625478089,39.969932884737;116.38594387735,39.967317055396',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 2}],\n",
       "      'start_location': {'lng': '116.38629484532', 'lat': '39.970283598926'},\n",
       "      'end_location': {'lng': '116.38594387735', 'lat': '39.967317055396'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 1094,\n",
       "      'duration': 111,\n",
       "      'direction': 6,\n",
       "      'turn': 1,\n",
       "      'road_type': 3,\n",
       "      'road_types': '1,3',\n",
       "      'instruction': '行驶1.1公里,<b>直行</b>进入<b>德胜门外大街</b>',\n",
       "      'path': '116.38594387735,39.967317055396;116.38589375191,39.966876051081;116.38586365867,39.966635502064;116.38586356884,39.966585456701;116.3858034722,39.96608437893;116.38575334676,39.965683389623;116.38572307386,39.965292766663;116.38571301284,39.965102535024;116.38570286199,39.964972372589;116.38569271113,39.964752139668;116.38567178062,39.963671425761;116.38570052639,39.962541544948;116.3857002569,39.962311487986;116.38573807556,39.960231400288;116.38574786709,39.960101574155;116.38574786709,39.960081526434;116.38575747896,39.959671583806;116.38575711964,39.959341484863;116.38576619252,39.958371295764;116.3857561315,39.958271123675;116.38574616031,39.958170951438;116.38569621453,39.957930025887;116.38559659244,39.957718342531;116.3855367653,39.957597360564;116.38548699917,39.95751654449',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 24}],\n",
       "      'start_location': {'lng': '116.38594387735', 'lat': '39.967317055396'},\n",
       "      'end_location': {'lng': '116.38548699917', 'lat': '39.95751654449'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 56,\n",
       "      'duration': 5,\n",
       "      'direction': 7,\n",
       "      'turn': 9,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '沿<b>德胜门外大街</b>行驶60米,<b>靠左</b>',\n",
       "      'path': '116.38548699917,39.95751654449;116.38531775841,39.957293660311;116.38523807872,39.957142328173;116.38519819395,39.957061649823',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 3}],\n",
       "      'start_location': {'lng': '116.38548699917', 'lat': '39.95751654449'},\n",
       "      'end_location': {'lng': '116.38519819395', 'lat': '39.957061649823'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 132,\n",
       "      'duration': 10,\n",
       "      'direction': 6,\n",
       "      'turn': 7,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '继续沿<b>德胜门外大街</b>行驶130米,朝<b>德胜门内大街,厂桥,鼓楼西大街,鼓楼方向</b>,<b>左转</b>进入<b>德胜门桥</b>',\n",
       "      'path': '116.38519819395,39.957061649823;116.38514824816,39.956770736863;116.38512785663,39.956170241003;116.38509785322,39.956009711507;116.38505796846,39.955878978549',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 4}],\n",
       "      'start_location': {'lng': '116.38519819395', 'lat': '39.957061649823'},\n",
       "      'end_location': {'lng': '116.38505796846', 'lat': '39.955878978549'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 140,\n",
       "      'duration': 13,\n",
       "      'direction': 4,\n",
       "      'turn': 14,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '沿<b>德胜门桥</b>行驶140米,<b>由环岛走第2出口</b>',\n",
       "      'path': '116.38505796846,39.955878978549;116.38519711598,39.955741262754;116.38542555507,39.955464931573;116.38544540763,39.955445228156;116.38548511273,39.955335856804;116.38551439749,39.954726153219',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 5}],\n",
       "      'start_location': {'lng': '116.38505796846', 'lat': '39.955878978549'},\n",
       "      'end_location': {'lng': '116.38551439749', 'lat': '39.954726153219'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 48,\n",
       "      'duration': 2,\n",
       "      'direction': 5,\n",
       "      'turn': 7,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '继续沿<b>德胜门桥</b>行驶50米,<b>左转</b>',\n",
       "      'path': '116.38551439749,39.954726153219;116.38565354501,39.954558430192;116.38591198751,39.95446260803',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 2}],\n",
       "      'start_location': {'lng': '116.38551439749', 'lat': '39.954726153219'},\n",
       "      'end_location': {'lng': '116.38591198751', 'lat': '39.95446260803'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 183,\n",
       "      'duration': 16,\n",
       "      'direction': 2,\n",
       "      'turn': 9,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '继续沿<b>德胜门桥</b>行驶180米,<b>靠左</b>',\n",
       "      'path': '116.38591198751,39.95446260803;116.38619055205,39.954577096831;116.38631002668,39.954749037078;116.38653882509,39.954752701261;116.38656864884,39.954753185209;116.38707592196,39.95477116044;116.38753342895,39.954788236905;116.38765281376,39.954790034427;116.38788161217,39.954803515843',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 8}],\n",
       "      'start_location': {'lng': '116.38591198751', 'lat': '39.95446260803'},\n",
       "      'end_location': {'lng': '116.38788161217', 'lat': '39.954803515843'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 66,\n",
       "      'duration': 5,\n",
       "      'direction': 3,\n",
       "      'turn': 1,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '继续沿<b>德胜门桥</b>行驶70米,<b>直行</b>进入<b>德胜门东大街</b>',\n",
       "      'path': '116.38788161217,39.954803515843;116.38822988522,39.954838774919;116.38863789558,39.954924917604',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 2}],\n",
       "      'start_location': {'lng': '116.38788161217', 'lat': '39.954803515843'},\n",
       "      'end_location': {'lng': '116.38863789558', 'lat': '39.954924917604'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 394,\n",
       "      'duration': 38,\n",
       "      'direction': 3,\n",
       "      'turn': 9,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '沿<b>德胜门东大街</b>行驶390米,<b>靠左</b>',\n",
       "      'path': '116.38863789558,39.954924917604;116.38897619743,39.954919870724;116.38937414677,39.954925608957;116.38984189445,39.954932176814;116.38997134028,39.954943998954;116.39113590354,39.954969786423;116.3932369503,39.955005944171',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 6}],\n",
       "      'start_location': {'lng': '116.38863789558', 'lat': '39.954924917604'},\n",
       "      'end_location': {'lng': '116.3932369503', 'lat': '39.955005944171'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 37,\n",
       "      'duration': 2,\n",
       "      'direction': 2,\n",
       "      'turn': 1,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '行驶40米,<b>直行</b>进入<b>北二环</b>',\n",
       "      'path': '116.3932369503,39.955005944171;116.39362555726,39.955150436699',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 1}],\n",
       "      'start_location': {'lng': '116.3932369503', 'lat': '39.955005944171'},\n",
       "      'end_location': {'lng': '116.39362555726', 'lat': '39.955150436699'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 1392,\n",
       "      'duration': 141,\n",
       "      'direction': 3,\n",
       "      'turn': 9,\n",
       "      'road_type': 1,\n",
       "      'road_types': '1',\n",
       "      'instruction': '沿<b>北二环</b>行驶1.4公里,朝<b>安定门桥,雍和宫桥方向</b>,<b>靠左</b>',\n",
       "      'path': '116.39362555726,39.955150436699;116.39552861748,39.95519067332;116.39610667708,39.95519627326;116.39626612631,39.955197794231;116.39735289631,39.955227314895;116.3973728387,39.9552275223;116.3978215423,39.955231186456;116.39830033914,39.955234850613;116.39868930542,39.955237754283;116.39981676867,39.955255245441;116.40016602985,39.955267344065;116.40047540627,39.955269141575;116.40052535205,39.955269418114;116.40105436417,39.955272183514;116.40184307641,39.955275916803;116.40367094846,39.95530218809;116.40493010329,39.955324726081;116.40678977536,39.955325624835;116.40994192939,39.955349614651',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 18}],\n",
       "      'start_location': {'lng': '116.39362555726', 'lat': '39.955150436699'},\n",
       "      'end_location': {'lng': '116.40994192939', 'lat': '39.955349614651'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 796,\n",
       "      'duration': 78,\n",
       "      'direction': 3,\n",
       "      'turn': 9,\n",
       "      'road_type': 1,\n",
       "      'road_types': '1',\n",
       "      'instruction': '继续沿<b>北二环</b>行驶800米,朝<b>雍和宫桥,小街桥方向</b>,<b>靠左</b>',\n",
       "      'path': '116.40994192939,39.955349614651;116.4115141437,39.955353140531;116.41181462689,39.955351688698;116.41231561187,39.955358947862;116.41702794292,39.955362957686;116.41803144,39.955382868532;116.41930631518,39.955409001508',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 6}],\n",
       "      'start_location': {'lng': '116.40994192939', 'lat': '39.955349614651'},\n",
       "      'end_location': {'lng': '116.41930631518', 'lat': '39.955409001508'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 767,\n",
       "      'duration': 76,\n",
       "      'direction': 3,\n",
       "      'turn': 9,\n",
       "      'road_type': 1,\n",
       "      'road_types': '1',\n",
       "      'instruction': '继续沿<b>北二环</b>行驶770米,朝<b>东直门桥方向</b>,<b>靠左</b>',\n",
       "      'path': '116.41930631518,39.955409001508;116.42076228875,39.955441633146;116.42142514839,39.955453247794;116.42331392555,39.955487815184;116.42415815307,39.955505721086;116.42459032785,39.955509385227;116.42638981345,39.95555190308;116.42647030162,39.95555058952;116.42669146444,39.955557088182;116.42673170853,39.95555646597;116.42708366463,39.95556089059;116.42834066353,39.955580386569',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 11}],\n",
       "      'start_location': {'lng': '116.41930631518', 'lat': '39.955409001508'},\n",
       "      'end_location': {'lng': '116.42834066353', 'lat': '39.955580386569'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 588,\n",
       "      'duration': 59,\n",
       "      'direction': 3,\n",
       "      'turn': 9,\n",
       "      'road_type': 1,\n",
       "      'road_types': '1',\n",
       "      'instruction': '继续沿<b>北二环</b>行驶590米,朝<b>东四十条桥,东直门桥,民安街方向</b>,<b>靠左</b>',\n",
       "      'path': '116.42834066353,39.955580386569;116.43076492061,39.955629195628;116.43324002178,39.955665491294;116.43369276775,39.955667357928;116.43447761728,39.955673165232;116.43527261765,39.955688789644',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 5}],\n",
       "      'start_location': {'lng': '116.42834066353', 'lat': '39.955580386569'},\n",
       "      'end_location': {'lng': '116.43527261765', 'lat': '39.955688789644'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 349,\n",
       "      'duration': 35,\n",
       "      'direction': 3,\n",
       "      'turn': 1,\n",
       "      'road_type': 1,\n",
       "      'road_types': '1',\n",
       "      'instruction': '继续沿<b>北二环</b>行驶350米,<b>直行</b>进入<b>东二环</b>',\n",
       "      'path': '116.43527261765,39.955688789644;116.43710408293,39.955695564831;116.43756688993,39.955637146109;116.43847238188,39.955380656216;116.43878418372,39.955234988883;116.43916632289,39.954997993616',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 5}],\n",
       "      'start_location': {'lng': '116.43527261765', 'lat': '39.955688789644'},\n",
       "      'end_location': {'lng': '116.43916632289', 'lat': '39.954997993616'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 123,\n",
       "      'duration': 10,\n",
       "      'direction': 4,\n",
       "      'turn': 9,\n",
       "      'road_type': 1,\n",
       "      'road_types': '1',\n",
       "      'instruction': '沿<b>东二环</b>行驶120米,朝<b>东直门桥,东四十条桥方向</b>,<b>靠左</b>',\n",
       "      'path': '116.43916632289,39.954997993616;116.43936745349,39.954844374888;116.43965904346,39.954559052414;116.43998063683,39.954083120517',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 3}],\n",
       "      'start_location': {'lng': '116.43916632289', 'lat': '39.954997993616'},\n",
       "      'end_location': {'lng': '116.43998063683', 'lat': '39.954083120517'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 1112,\n",
       "      'duration': 111,\n",
       "      'direction': 5,\n",
       "      'turn': 2,\n",
       "      'road_type': 1,\n",
       "      'road_types': '1',\n",
       "      'instruction': '继续沿<b>东二环</b>行驶1.1公里,<b>右前方转弯</b>',\n",
       "      'path': '116.43998063683,39.954083120517;116.44015131488,39.953669961359;116.44024141492,39.953078218483;116.44018976235,39.951268665928;116.44018958269,39.951028614679;116.44018949286,39.950838550458;116.44016874201,39.949928668528;116.44016865218,39.94987867998;116.44016847251,39.949488588279;116.4401872471,39.947377822788;116.4402172505,39.947017171803;116.44033663531,39.944084529677',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 11}],\n",
       "      'start_location': {'lng': '116.43998063683', 'lat': '39.954083120517'},\n",
       "      'end_location': {'lng': '116.44033663531', 'lat': '39.944084529677'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 31,\n",
       "      'duration': 2,\n",
       "      'direction': 7,\n",
       "      'turn': 1,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '行驶30米,<b>直行</b>进入<b>东直门南大街</b>',\n",
       "      'path': '116.44033663531,39.944084529677;116.4401754793,39.943837400059',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 1}],\n",
       "      'start_location': {'lng': '116.44033663531', 'lat': '39.944084529677'},\n",
       "      'end_location': {'lng': '116.4401754793', 'lat': '39.943837400059'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 212,\n",
       "      'duration': 19,\n",
       "      'direction': 6,\n",
       "      'turn': 10,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '沿<b>东直门南大街</b>行驶210米,<b>靠右</b>',\n",
       "      'path': '116.4401754793,39.943837400059;116.44019551151,39.943416987226;116.44021545389,39.943016555411;116.44021545389,39.942926525346;116.44021536406,39.942816511487;116.44022542508,39.942636312411;116.44022533525,39.942586318492;116.44024527764,39.941935910155',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 7}],\n",
       "      'start_location': {'lng': '116.4401754793', 'lat': '39.943837400059'},\n",
       "      'end_location': {'lng': '116.44024527764', 'lat': '39.941935910155'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 437,\n",
       "      'duration': 43,\n",
       "      'direction': 6,\n",
       "      'turn': 14,\n",
       "      'road_type': 3,\n",
       "      'road_types': '3',\n",
       "      'instruction': '继续沿<b>东直门南大街</b>行驶440米,朝<b>工人体育场北路,工人体育场方向</b>,<b>由环岛走第4出口</b>进入<b>工人体育场北路</b>',\n",
       "      'path': '116.44024527764,39.941935910155;116.44027537087,39.941655304676;116.44020494372,39.941626607895;116.44016469963,39.941547294077;116.44016451997,39.940997280971;116.44017449116,39.940797023647;116.44018455218,39.940506870758;116.44019452337,39.94042665668;116.44018446235,39.940196801333;116.44016425048,39.940037202156;116.44013406741,39.940017701711;116.43989260289,39.939822005445;116.43987248085,39.939742343764;116.43988245204,39.939552178785;116.43998306226,39.939360353644;116.44021446576,39.939226200195;116.44025470984,39.939205523944;116.44034525904,39.939193906516;116.44038550313,39.939193145851;116.44087849319,39.93922440226;116.44091873728,39.939233737689;116.44103946954,39.939241551788;116.4411602018,39.939299431414;116.44134130019,39.93946629319;116.44136142223,39.939495889848',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 24}],\n",
       "      'start_location': {'lng': '116.44024527764', 'lat': '39.941935910155'},\n",
       "      'end_location': {'lng': '116.44136142223', 'lat': '39.939495889848'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 305,\n",
       "      'duration': 29,\n",
       "      'direction': 3,\n",
       "      'turn': 9,\n",
       "      'road_type': 4,\n",
       "      'road_types': '4',\n",
       "      'instruction': '沿<b>工人体育场北路</b>行驶310米,<b>靠左</b>',\n",
       "      'path': '116.44136142223,39.939495889848;116.44166325288,39.939550588312;116.44203551069,39.939554115013;116.44218642601,39.939551487275;116.44227697521,39.939549896802;116.44250837871,39.939545886043;116.44262902114,39.939543811513;116.44314204341,39.939535029335;116.44430885244,39.939545263684;116.44495248834,39.939534614429',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 9}],\n",
       "      'start_location': {'lng': '116.44136142223', 'lat': '39.939495889848'},\n",
       "      'end_location': {'lng': '116.44495248834', 'lat': '39.939534614429'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 334,\n",
       "      'duration': 32,\n",
       "      'direction': 3,\n",
       "      'turn': 3,\n",
       "      'road_type': 4,\n",
       "      'road_types': '4,6',\n",
       "      'instruction': '继续沿<b>工人体育场北路</b>行驶330米,<b>右转</b>进入<b>工人体育场北路辅路</b>',\n",
       "      'path': '116.44495248834,39.939534614429;116.44631000762,39.939502666652;116.44878295286,39.939464979319;116.44878295286,39.939394929232',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 3}],\n",
       "      'start_location': {'lng': '116.44495248834', 'lat': '39.939534614429'},\n",
       "      'end_location': {'lng': '116.44878295286', 'lat': '39.939394929232'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 42,\n",
       "      'duration': 2,\n",
       "      'direction': 3,\n",
       "      'turn': 3,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5',\n",
       "      'instruction': '沿<b>工人体育场北路辅路</b>行驶40米,<b>右转</b>',\n",
       "      'path': '116.44878295286,39.939394929232;116.44926534292,39.939377987196',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 1}],\n",
       "      'start_location': {'lng': '116.44878295286', 'lat': '39.939394929232'},\n",
       "      'end_location': {'lng': '116.44926534292', 'lat': '39.939377987196'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 15,\n",
       "      'duration': 0,\n",
       "      'direction': 3,\n",
       "      'turn': 3,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5',\n",
       "      'instruction': '继续沿<b>工人体育场北路辅路</b>行驶20米,<b>右转</b>',\n",
       "      'path': '116.44926534292,39.939377987196;116.44944626165,39.939375428602',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 1}],\n",
       "      'start_location': {'lng': '116.44926534292', 'lat': '39.939377987196'},\n",
       "      'end_location': {'lng': '116.44944626165', 'lat': '39.939375428602'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 70,\n",
       "      'duration': 5,\n",
       "      'direction': 3,\n",
       "      'turn': 3,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5',\n",
       "      'instruction': '继续沿<b>工人体育场北路辅路</b>行驶70米,<b>右转</b>进入<b>工人体育场西路</b>',\n",
       "      'path': '116.44944626165,39.939375428602;116.45027018747,39.939363880354',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 1}],\n",
       "      'start_location': {'lng': '116.44944626165', 'lat': '39.939375428602'},\n",
       "      'end_location': {'lng': '116.45027018747', 'lat': '39.939363880354'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 65,\n",
       "      'duration': 5,\n",
       "      'direction': 6,\n",
       "      'turn': 9,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5',\n",
       "      'instruction': '沿<b>工人体育场西路</b>行驶70米,<b>靠左</b>',\n",
       "      'path': '116.45027018747,39.939363880354;116.45026012644,39.93918401787;116.45027009763,39.938783837692',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 2}],\n",
       "      'start_location': {'lng': '116.45027018747', 'lat': '39.939363880354'},\n",
       "      'end_location': {'lng': '116.45027009763', 'lat': '39.938783837692'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 237,\n",
       "      'duration': 21,\n",
       "      'direction': 6,\n",
       "      'turn': 7,\n",
       "      'road_type': 5,\n",
       "      'road_types': '5,6',\n",
       "      'instruction': '继续沿<b>工人体育场西路</b>行驶240米,<b>左转</b>',\n",
       "      'path': '116.45027009763,39.938783837692;116.45029004002,39.937963554308;116.45028995019,39.936763538344;116.45028995019,39.936693485469;116.45034016546,39.93669279393',\n",
       "      'traffic_condition': [{'status': 1, 'geo_cnt': 4}],\n",
       "      'start_location': {'lng': '116.45027009763', 'lat': '39.938783837692'},\n",
       "      'end_location': {'lng': '116.45034016546', 'lat': '39.93669279393'}},\n",
       "     {'leg_index': 0,\n",
       "      'distance': 169,\n",
       "      'duration': 16,\n",
       "      'direction': 3,\n",
       "      'turn': 0,\n",
       "      'road_type': 6,\n",
       "      'road_types': '6',\n",
       "      'instruction': '行驶170米,到达<b>终点</b>(在道路<b>右侧</b>)',\n",
       "      'path': '116.45034016546,39.93669279393;116.45064154696,39.936658701043;116.45097311153,39.936634289696;116.45110372515,39.936632560847;116.45152556942,39.936617070355;116.45189719841,39.936592313223;116.45234913591,39.936596669926',\n",
       "      'traffic_condition': [{'status': 0, 'geo_cnt': 6}],\n",
       "      'start_location': {'lng': '116.45034016546', 'lat': '39.93669279393'},\n",
       "      'end_location': {'lng': '116.45234913591',\n",
       "       'lat': '39.936596669926'}}]}]}}"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'畅通'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lukuang"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 2、 公交相关"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "#公交地铁\n",
    "url = f'http://api.map.baidu.com/directionlite/v1/transit?origin=40.01116,116.339303&destination=39.936404,116.452562&ak={AK}' \n",
    "data1 = requests.get(url)\n",
    "data1 = data1.content.decode('unicode_escape')\n",
    "data1 = json.loads(data1)\n",
    "\n",
    "time_cost1 = round(data1['result']['routes'][0]['duration']/60) #驾车耗时"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'status': 0,\n",
       " 'message': 'ok',\n",
       " 'result': {'origin': {'lng': 116.33929505188, 'lat': 40.011157363344},\n",
       "  'destination': {'lng': 116.45255341058, 'lat': 39.936401378723},\n",
       "  'routes': [{'distance': 21421,\n",
       "    'duration': 5342,\n",
       "    'price': 7,\n",
       "    'line_price': [{'line_price': 5, 'line_type': 1},\n",
       "     {'line_price': 2, 'line_type': 0}],\n",
       "    'steps': [[{'distance': 1159,\n",
       "       'duration': 989,\n",
       "       'type': 5,\n",
       "       'instruction': '步行1.2公里',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.33996878101,40.011178086743;116.34000471324,40.010542566293;116.34002267935,40.010169540643;116.34006759462,40.009368219334;116.34052573043,40.009375127317;116.3407323407,40.009375127317;116.3409120018,40.009361311351;116.34188217175,40.00933367941;116.34237623978,40.009306047457;116.34248403644,40.009299139467;116.34333742668,40.009312955446;116.34350810472,40.009312955446;116.34360691833,40.009319863435;116.34365183361,40.008249116812;116.34367878277,40.007592844385;116.34369674888,40.007047097208;116.34374166416,40.00614902266;116.34383149471,40.00605921455;116.34394827442,40.00605921455;116.34414590164,40.006066122871;116.34450522384,40.006086847828;116.34456810523,40.006093756145;116.34463996967,40.006107572778;116.34480166466,40.006142114348;116.34494539354,40.006093756145;116.34547539379,40.006114481094;116.34548437685,40.006114481094;116.3454933599,40.00591413966;116.3454933599,40.00591413966;116.34552030907,40.00591413966;116.34580776683,40.00591413966;116.34582573294,40.006301005344;116.3454933599,40.006294097047;116.3454933599,40.006294097047;116.34552030907,40.006294097047',\n",
       "       'start_location': {'lng': 116.33929505188, 'lat': 40.011157363344},\n",
       "       'end_location': {'lng': 116.34552030907, 'lat': 40.006294097047}}],\n",
       "     [{'distance': 4496,\n",
       "       'duration': 420,\n",
       "       'type': 3,\n",
       "       'instruction': '清华东路西口站(C口)乘地铁15号线(俸伯方向)经过3站到奥林匹克公园站',\n",
       "       'vehicle': {'direct_text': '俸伯方向',\n",
       "        'name': '地铁15号线',\n",
       "        'line_id': '6363d7f82d1625bed7b74e6c',\n",
       "        'start_name': '清华东路西口站(C口)',\n",
       "        'end_name': '奥林匹克公园站',\n",
       "        'start_time': '05:42',\n",
       "        'end_time': '23:15',\n",
       "        'stop_num': 3,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.34552030907,40.006294097047;116.35930031559,40.006715501839;116.37555964532,40.007537579048;116.39823287639,40.008504715931',\n",
       "       'start_location': {'lng': 116.34552030907, 'lat': 40.006294097047},\n",
       "       'end_location': {'lng': 116.39823287639, 'lat': 40.008504715931}}],\n",
       "     [{'distance': 281,\n",
       "       'duration': 234,\n",
       "       'type': 5,\n",
       "       'instruction': '站内换乘 步行281米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.39822389334,40.00849780786;116.39823287639,40.008511624002;116.39849338499,40.008511624002;116.39852033415,40.008000424851;116.39872694442,40.008000424851;116.39874491053,40.007793180853;116.39914016496,40.007793180853;116.39925694467,40.007806997139;116.39928389384,40.00736487458;116.39928389384,40.00736487458;116.39926592773,40.007344150014',\n",
       "       'start_location': {'lng': 116.39823287639, 'lat': 40.008504715931},\n",
       "       'end_location': {'lng': 116.39927491078, 'lat': 40.007351058204}}],\n",
       "     [{'distance': 8129,\n",
       "       'duration': 1020,\n",
       "       'type': 3,\n",
       "       'instruction': '奥林匹克公园站乘地铁8号线(中国美术馆方向)经过7站到南锣鼓巷站',\n",
       "       'vehicle': {'direct_text': '中国美术馆方向',\n",
       "        'name': '地铁8号线',\n",
       "        'line_id': '86147d290c19ca50a2d230ac',\n",
       "        'start_name': '奥林匹克公园站',\n",
       "        'end_name': '南锣鼓巷站',\n",
       "        'start_time': '05:00',\n",
       "        'end_time': '22:35',\n",
       "        'stop_num': 7,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.39927491078,40.007351058204;116.40002050436,39.996013771386;116.40070321654,39.982477012037;116.40061338599,39.980265543793;116.40061338599,39.974245838234;116.40152067456,39.964098902222;116.40155660678,39.963048179058;116.401592539,39.960974335576;116.4009727082,39.95863081614;116.40023609768,39.95464872137;116.40099965736,39.949387296819;116.40243694618,39.944962129878;116.40280525144,39.940923913284;116.40286813282,39.940647314315;116.40303881087,39.94039837428;116.40329931947,39.940184008518;116.40386525194,39.940087197952;116.41045881438,39.940107943085',\n",
       "       'start_location': {'lng': 116.39927491078, 'lat': 40.007351058204},\n",
       "       'end_location': {'lng': 116.41045881438, 'lat': 39.940107943085}}],\n",
       "     [{'distance': 106,\n",
       "       'duration': 88,\n",
       "       'type': 5,\n",
       "       'instruction': '站内换乘 步行106米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.41045881438,39.940107943085;116.40947067832,39.939527076968;116.40947067832,39.93953399207',\n",
       "       'start_location': {'lng': 116.41045881438, 'lat': 39.940107943085},\n",
       "       'end_location': {'lng': 116.40947067832, 'lat': 39.939527076968}}],\n",
       "     [{'distance': 4990,\n",
       "       'duration': 540,\n",
       "       'type': 3,\n",
       "       'instruction': '南锣鼓巷站乘地铁6号线(潞城方向)经过3站到东大桥站(B口)',\n",
       "       'vehicle': {'direct_text': '潞城方向',\n",
       "        'name': '地铁6号线',\n",
       "        'line_id': 'a15f370891be585133870acc',\n",
       "        'start_name': '南锣鼓巷站',\n",
       "        'end_name': '东大桥站',\n",
       "        'start_time': '05:43',\n",
       "        'end_time': '00:11',\n",
       "        'stop_num': 3,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.40947067832,39.939527076968;116.41165356071,39.939527076968;116.41185118792,39.939471756126;116.41204881514,39.939077593823;116.41257881539,39.93656734862;116.41298305287,39.932134430023;116.41353101923,39.931553495686;116.41436644335,39.93112470763;116.41592051188,39.930640588829;116.41845373342,39.930633672822;116.42091509052,39.9305230166;116.42595458443,39.930564512704;116.42903577233,39.930460772396;116.43495560564,39.930564512704;116.44282476191,39.930384696069;116.44805289998,39.929928236318;116.45680239564,39.928406681658;116.4574312095,39.928392849186;116.45842832862,39.928662581872',\n",
       "       'start_location': {'lng': 116.40947067832, 'lat': 39.939527076968},\n",
       "       'end_location': {'lng': 116.45842832862, 'lat': 39.928662581872}}],\n",
       "     [{'distance': 296,\n",
       "       'duration': 248,\n",
       "       'type': 5,\n",
       "       'instruction': '步行296米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.45842832862,39.928655665662;116.45841934556,39.928655665662;116.45841934556,39.928655665662;116.45862595583,39.928717911521;116.45845527778,39.929042972299;116.45916493913,39.92923662479;116.45920087135,39.92924354094;116.45920087135,39.92924354094;116.45927273579,39.929125966291;116.45927273579,39.929077553142;116.45924578663,39.929070636975;116.45920087135,39.929063720807;116.45915595608,39.929056804638;116.45902121025,39.928994559091;116.45898527803,39.928987642915;116.45888646443,39.928980726739;116.45879663387,39.928959978206;116.45874273554,39.928953062027;116.45868883721,39.928932313486;116.45865290499,39.928925397304;116.45863493888,39.928911564938;116.45859002361,39.928897732569;116.45854510833,39.928876984011;116.45814985391,39.928697162908;116.45810493863,39.928676414288;116.45806900641,39.928662581872;116.45801510808,39.928648749452;116.45797019281,39.928641833242',\n",
       "       'start_location': {'lng': 116.45842832862, 'lat': 39.928662581872},\n",
       "       'end_location': {'lng': 116.45792527753, 'lat': 39.928807822105}}],\n",
       "     [{'distance': 1516,\n",
       "       'duration': 369,\n",
       "       'type': 3,\n",
       "       'instruction': '东大桥公交场站乘515路(北土城公交场站方向)经过3站到工人体育场西门站',\n",
       "       'vehicle': {'direct_text': '北土城公交场站方向',\n",
       "        'name': '515路',\n",
       "        'line_id': 'c47d25067cf66173911fc97c',\n",
       "        'start_name': '东大桥公交场站',\n",
       "        'end_name': '工人体育场西门站',\n",
       "        'start_time': '05:30',\n",
       "        'end_time': '22:00',\n",
       "        'stop_num': 3,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.45791629447,39.928821654492;116.45876968471,39.929125966291;116.45885951526,39.929029139958;116.45793426058,39.928641833242;116.45698205674,39.928600335962;116.45700900591,39.9326738646;116.4503884943,39.932756854155;116.45041544347,39.934866137951',\n",
       "       'start_location': {'lng': 116.45792527753, 'lat': 39.928807822105},\n",
       "       'end_location': {'lng': 116.45041544347, 'lat': 39.934866137951}}],\n",
       "     [{'distance': 448,\n",
       "       'duration': 384,\n",
       "       'type': 5,\n",
       "       'instruction': '步行448米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.45033459597,39.934866137951;116.45033459597,39.934465033291;116.45052324013,39.934471948908;116.45071188428,39.934471948908;116.45081968095,39.934465033291;116.45114307093,39.934451202053;116.4513496812,39.934444286433;116.45194256283,39.9344027927;116.45199646116,39.9344027927;116.4520683256,39.934395877075;116.45213120699,39.9344027927;116.45216713921,39.934458117672;116.45216713921,39.9345134426;116.45218510532,39.934561851874;116.45240069864,39.934817728893;116.45244561392,39.934866137951;116.45298459722,39.935488537043;116.45277798696,39.93565450917;116.4525084953,39.936014114055;116.45243663086,39.936173169454;116.45239171559,39.936380632458',\n",
       "       'start_location': {'lng': 116.45041544347, 'lat': 39.934866137951},\n",
       "       'end_location': {'lng': 116.45255341058, 'lat': 39.936401378723}}]],\n",
       "    'traffic_condition': 1},\n",
       "   {'distance': 20703,\n",
       "    'duration': 5056,\n",
       "    'price': 5,\n",
       "    'line_price': [{'line_price': 5, 'line_type': 1}],\n",
       "    'steps': [[{'distance': 1159,\n",
       "       'duration': 989,\n",
       "       'type': 5,\n",
       "       'instruction': '步行1.2公里',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.33996878101,40.011178086743;116.34000471324,40.010542566293;116.34002267935,40.010169540643;116.34006759462,40.009368219334;116.34052573043,40.009375127317;116.3407323407,40.009375127317;116.3409120018,40.009361311351;116.34188217175,40.00933367941;116.34237623978,40.009306047457;116.34248403644,40.009299139467;116.34333742668,40.009312955446;116.34350810472,40.009312955446;116.34360691833,40.009319863435;116.34365183361,40.008249116812;116.34367878277,40.007592844385;116.34369674888,40.007047097208;116.34374166416,40.00614902266;116.34383149471,40.00605921455;116.34394827442,40.00605921455;116.34414590164,40.006066122871;116.34450522384,40.006086847828;116.34456810523,40.006093756145;116.34463996967,40.006107572778;116.34480166466,40.006142114348;116.34494539354,40.006093756145;116.34547539379,40.006114481094;116.34548437685,40.006114481094;116.3454933599,40.00591413966;116.3454933599,40.00591413966;116.34552030907,40.00591413966;116.34580776683,40.00591413966;116.34582573294,40.006301005344;116.3454933599,40.006294097047;116.3454933599,40.006294097047;116.34552030907,40.006294097047',\n",
       "       'start_location': {'lng': 116.33929505188, 'lat': 40.011157363344},\n",
       "       'end_location': {'lng': 116.34552030907, 'lat': 40.006294097047}}],\n",
       "     [{'distance': 4496,\n",
       "       'duration': 420,\n",
       "       'type': 3,\n",
       "       'instruction': '清华东路西口站(C口)乘地铁15号线(俸伯方向)经过3站到奥林匹克公园站',\n",
       "       'vehicle': {'direct_text': '俸伯方向',\n",
       "        'name': '地铁15号线',\n",
       "        'line_id': '6363d7f82d1625bed7b74e6c',\n",
       "        'start_name': '清华东路西口站(C口)',\n",
       "        'end_name': '奥林匹克公园站',\n",
       "        'start_time': '05:42',\n",
       "        'end_time': '23:15',\n",
       "        'stop_num': 3,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.34552030907,40.006294097047;116.35930031559,40.006715501839;116.37555964532,40.007537579048;116.39823287639,40.008504715931',\n",
       "       'start_location': {'lng': 116.34552030907, 'lat': 40.006294097047},\n",
       "       'end_location': {'lng': 116.39823287639, 'lat': 40.008504715931}}],\n",
       "     [{'distance': 281,\n",
       "       'duration': 234,\n",
       "       'type': 5,\n",
       "       'instruction': '站内换乘 步行281米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.39822389334,40.00849780786;116.39823287639,40.008511624002;116.39849338499,40.008511624002;116.39852033415,40.008000424851;116.39872694442,40.008000424851;116.39874491053,40.007793180853;116.39914016496,40.007793180853;116.39925694467,40.007806997139;116.39928389384,40.00736487458;116.39928389384,40.00736487458;116.39926592773,40.007344150014',\n",
       "       'start_location': {'lng': 116.39823287639, 'lat': 40.008504715931},\n",
       "       'end_location': {'lng': 116.39927491078, 'lat': 40.007351058204}}],\n",
       "     [{'distance': 8129,\n",
       "       'duration': 1020,\n",
       "       'type': 3,\n",
       "       'instruction': '奥林匹克公园站乘地铁8号线(中国美术馆方向)经过7站到南锣鼓巷站',\n",
       "       'vehicle': {'direct_text': '中国美术馆方向',\n",
       "        'name': '地铁8号线',\n",
       "        'line_id': '86147d290c19ca50a2d230ac',\n",
       "        'start_name': '奥林匹克公园站',\n",
       "        'end_name': '南锣鼓巷站',\n",
       "        'start_time': '05:00',\n",
       "        'end_time': '22:35',\n",
       "        'stop_num': 7,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.39927491078,40.007351058204;116.40002050436,39.996013771386;116.40070321654,39.982477012037;116.40061338599,39.980265543793;116.40061338599,39.974245838234;116.40152067456,39.964098902222;116.40155660678,39.963048179058;116.401592539,39.960974335576;116.4009727082,39.95863081614;116.40023609768,39.95464872137;116.40099965736,39.949387296819;116.40243694618,39.944962129878;116.40280525144,39.940923913284;116.40286813282,39.940647314315;116.40303881087,39.94039837428;116.40329931947,39.940184008518;116.40386525194,39.940087197952;116.41045881438,39.940107943085',\n",
       "       'start_location': {'lng': 116.39927491078, 'lat': 40.007351058204},\n",
       "       'end_location': {'lng': 116.41045881438, 'lat': 39.940107943085}}],\n",
       "     [{'distance': 106,\n",
       "       'duration': 88,\n",
       "       'type': 5,\n",
       "       'instruction': '站内换乘 步行106米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.41045881438,39.940107943085;116.40947067832,39.939527076968;116.40947067832,39.93953399207',\n",
       "       'start_location': {'lng': 116.41045881438, 'lat': 39.940107943085},\n",
       "       'end_location': {'lng': 116.40947067832, 'lat': 39.939527076968}}],\n",
       "     [{'distance': 4990,\n",
       "       'duration': 540,\n",
       "       'type': 3,\n",
       "       'instruction': '南锣鼓巷站乘地铁6号线(潞城方向)经过3站到东大桥站(A口)',\n",
       "       'vehicle': {'direct_text': '潞城方向',\n",
       "        'name': '地铁6号线',\n",
       "        'line_id': 'a15f370891be585133870acc',\n",
       "        'start_name': '南锣鼓巷站',\n",
       "        'end_name': '东大桥站',\n",
       "        'start_time': '05:43',\n",
       "        'end_time': '00:11',\n",
       "        'stop_num': 3,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.40947067832,39.939527076968;116.41165356071,39.939527076968;116.41185118792,39.939471756126;116.41204881514,39.939077593823;116.41257881539,39.93656734862;116.41298305287,39.932134430023;116.41353101923,39.931553495686;116.41436644335,39.93112470763;116.41592051188,39.930640588829;116.41845373342,39.930633672822;116.42091509052,39.9305230166;116.42595458443,39.930564512704;116.42903577233,39.930460772396;116.43495560564,39.930564512704;116.44282476191,39.930384696069;116.44805289998,39.929928236318;116.45680239564,39.928406681658;116.4574312095,39.928392849186;116.45842832862,39.928662581872',\n",
       "       'start_location': {'lng': 116.40947067832, 'lat': 39.939527076968},\n",
       "       'end_location': {'lng': 116.45842832862, 'lat': 39.928662581872}}],\n",
       "     [{'distance': 1542,\n",
       "       'duration': 1315,\n",
       "       'type': 5,\n",
       "       'instruction': '步行1.5公里',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.45842832862,39.928655665662;116.45841934556,39.928655665662;116.45841934556,39.928655665662;116.45793426058,39.928524257552;116.45793426058,39.928524257552;116.45747612477,39.92938877993;116.45748510783,39.92938877993;116.45745815866,39.929381863795;116.45728748062,39.929333450828;116.4572515484,39.929333450828;116.4572515484,39.929333450828;116.45713476868,39.929333450828;116.45709883646,39.929333450828;116.45709883646,39.929312702403;116.45708985341,39.928814738298;116.45708087035,39.928724827724;116.45700900591,39.928641833242;116.45689222619,39.928655665662;116.45676646342,39.928662581872;116.45662273454,39.928766324927;116.45577832736,39.928849319257;116.45540103905,39.928883900198;116.45482612352,39.928932313486;116.45447578437,39.928973810562;116.45360442803,39.929056804638;116.45314629222,39.929105217803;116.45275103779,39.929146714774;116.45271510557,39.92924354094;116.45269713946,39.929430276728;116.45269713946,39.9294717735;116.45268815641,39.929644676444;116.45267917335,39.930011229229;116.45267917335,39.930121886284;116.45267917335,39.93022562711;116.45267917335,39.93028787153;116.45267917335,39.930433108287;116.45267917335,39.930785824832;116.45268815641,39.931193867177;116.45268815641,39.931352933868;116.45267917335,39.931719477432;116.45267917335,39.932120598311;116.45267917335,39.932251999463;116.45267917335,39.932307326188;116.45267917335,39.932701527797;116.45261629197,39.932957411827;116.45256239364,39.933068064082;116.4525084953,39.933137221649;116.45204137644,39.933559081287;116.45202341033,39.93359365983;116.45197849505,39.933725058131;116.45193357978,39.934001685303;116.45196052894,39.934195323652;116.45199646116,39.9344027927;116.4520683256,39.934395877075;116.45213120699,39.9344027927;116.45216713921,39.934458117672;116.45216713921,39.9345134426;116.45218510532,39.934561851874;116.45240069864,39.934817728893;116.45244561392,39.934866137951;116.45298459722,39.935488537043;116.45277798696,39.93565450917;116.4525084953,39.936014114055;116.45243663086,39.936173169454;116.45239171559,39.936380632458',\n",
       "       'start_location': {'lng': 116.45842832862, 'lat': 39.928662581872},\n",
       "       'end_location': {'lng': 116.45255341058, 'lat': 39.936401378723}}]],\n",
       "    'traffic_condition': 1},\n",
       "   {'distance': 22167,\n",
       "    'duration': 5272,\n",
       "    'price': 5,\n",
       "    'line_price': [{'line_price': 5, 'line_type': 1}],\n",
       "    'steps': [[{'distance': 1159,\n",
       "       'duration': 989,\n",
       "       'type': 5,\n",
       "       'instruction': '步行1.2公里',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.33996878101,40.011178086743;116.34000471324,40.010542566293;116.34002267935,40.010169540643;116.34006759462,40.009368219334;116.34052573043,40.009375127317;116.3407323407,40.009375127317;116.3409120018,40.009361311351;116.34188217175,40.00933367941;116.34237623978,40.009306047457;116.34248403644,40.009299139467;116.34333742668,40.009312955446;116.34350810472,40.009312955446;116.34360691833,40.009319863435;116.34365183361,40.008249116812;116.34367878277,40.007592844385;116.34369674888,40.007047097208;116.34374166416,40.00614902266;116.34383149471,40.00605921455;116.34394827442,40.00605921455;116.34414590164,40.006066122871;116.34450522384,40.006086847828;116.34456810523,40.006093756145;116.34463996967,40.006107572778;116.34480166466,40.006142114348;116.34494539354,40.006093756145;116.34547539379,40.006114481094;116.34548437685,40.006114481094;116.3454933599,40.00591413966;116.3454933599,40.00591413966;116.34552030907,40.00591413966;116.34580776683,40.00591413966;116.34582573294,40.006301005344;116.3454933599,40.006294097047;116.3454933599,40.006294097047;116.34552030907,40.006294097047',\n",
       "       'start_location': {'lng': 116.33929505188, 'lat': 40.011157363344},\n",
       "       'end_location': {'lng': 116.34552030907, 'lat': 40.006294097047}}],\n",
       "     [{'distance': 6797,\n",
       "       'duration': 720,\n",
       "       'type': 3,\n",
       "       'instruction': '清华东路西口站(C口)乘地铁15号线(俸伯方向)经过5站到大屯路东站',\n",
       "       'vehicle': {'direct_text': '俸伯方向',\n",
       "        'name': '地铁15号线',\n",
       "        'line_id': '6363d7f82d1625bed7b74e6c',\n",
       "        'start_name': '清华东路西口站(C口)',\n",
       "        'end_name': '大屯路东站',\n",
       "        'start_time': '05:42',\n",
       "        'end_time': '23:15',\n",
       "        'stop_num': 5,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.34552030907,40.006294097047;116.35930031559,40.006715501839;116.37555964532,40.007537579048;116.39898745302,40.008539256279;116.4142766128,40.008939923023;116.42523594002,40.009112623474',\n",
       "       'start_location': {'lng': 116.34552030907, 'lat': 40.006294097047},\n",
       "       'end_location': {'lng': 116.42523594002, 'lat': 40.009112623474}}],\n",
       "     [{'distance': 373,\n",
       "       'duration': 310,\n",
       "       'type': 5,\n",
       "       'instruction': '站内换乘 步行373米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.42523594002,40.009105715465;116.42523594002,40.009091899443;116.42565814361,40.009105715465;116.42565814361,40.009105715465;116.42560424528,40.009520194794;116.4242208548,40.009458023056;116.42410407508,40.009520194794;116.42397831231,40.009561642587;116.42388848176,40.010107369501;116.42388848176,40.010107369501;116.42388848176,40.010093553684',\n",
       "       'start_location': {'lng': 116.42523594002, 'lat': 40.009112623474},\n",
       "       'end_location': {'lng': 116.42388848176, 'lat': 40.010100461593}}],\n",
       "     [{'distance': 9012,\n",
       "       'duration': 1020,\n",
       "       'type': 3,\n",
       "       'instruction': '大屯路东站乘地铁5号线(宋家庄方向)经过8站到东四站',\n",
       "       'vehicle': {'direct_text': '宋家庄方向',\n",
       "        'name': '地铁5号线',\n",
       "        'line_id': '3039f3071bdd32f0f7e73bb7',\n",
       "        'start_name': '大屯路东站',\n",
       "        'end_name': '东四站',\n",
       "        'start_time': '05:15',\n",
       "        'end_time': '23:03',\n",
       "        'stop_num': 8,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.42388848176,40.010100461593;116.42400526147,40.009402759241;116.4241400073,40.007779364564;116.42338543067,40.001589383562;116.42333153234,39.997133076071;116.42350221039,39.994770077827;116.42474187199,39.968322368621;116.42538865196,39.960407473991;116.42529882141,39.960206997418;116.4253796689,39.95842342114;116.42529882141,39.958112327451;116.42499339753,39.957766666125;116.42464305839,39.957566181748;116.4235201765,39.957490135795;116.42310695596,39.957393349913;116.42279254903,39.957130644682;116.42268475237,39.956867938433;116.42294526097,39.955851670469;116.42394238009,39.93051610058',\n",
       "       'start_location': {'lng': 116.42388848176, 'lat': 40.010100461593},\n",
       "       'end_location': {'lng': 116.42394238009, 'lat': 39.93051610058}}],\n",
       "     [{'distance': 202,\n",
       "       'duration': 168,\n",
       "       'type': 5,\n",
       "       'instruction': '站内换乘 步行202米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.42393339703,39.930509184559;116.42392441398,39.930495352516;116.42392441398,39.930495352516;116.42392441398,39.930322451738;116.42367288843,39.930315535698;116.42367288843,39.930315535698;116.42367288843,39.930509184559;116.42355610872,39.930509184559;116.42343034595,39.930536848637;116.42260390488,39.930529932619;116.42260390488,39.930529932619',\n",
       "       'start_location': {'lng': 116.42394238009, 'lat': 39.93051610058},\n",
       "       'end_location': {'lng': 116.42261288793, 'lat': 39.930536848637}}],\n",
       "     [{'distance': 3082,\n",
       "       'duration': 300,\n",
       "       'type': 3,\n",
       "       'instruction': '东四站乘地铁6号线(潞城方向)经过2站到东大桥站(A口)',\n",
       "       'vehicle': {'direct_text': '潞城方向',\n",
       "        'name': '地铁6号线',\n",
       "        'line_id': 'a15f370891be585133870acc',\n",
       "        'start_name': '东四站',\n",
       "        'end_name': '东大桥站',\n",
       "        'start_time': '05:47',\n",
       "        'end_time': '00:15',\n",
       "        'stop_num': 2,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.42261288793,39.930536848637;116.42595458443,39.930564512704;116.42903577233,39.930460772396;116.43495560564,39.930564512704;116.44282476191,39.930384696069;116.44805289998,39.929928236318;116.45680239564,39.928406681658;116.4574312095,39.928392849186;116.45842832862,39.928662581872',\n",
       "       'start_location': {'lng': 116.42261288793, 'lat': 39.930536848637},\n",
       "       'end_location': {'lng': 116.45842832862, 'lat': 39.928662581872}}],\n",
       "     [{'distance': 1542,\n",
       "       'duration': 1315,\n",
       "       'type': 5,\n",
       "       'instruction': '步行1.5公里',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.45842832862,39.928655665662;116.45841934556,39.928655665662;116.45841934556,39.928655665662;116.45793426058,39.928524257552;116.45793426058,39.928524257552;116.45747612477,39.92938877993;116.45748510783,39.92938877993;116.45745815866,39.929381863795;116.45728748062,39.929333450828;116.4572515484,39.929333450828;116.4572515484,39.929333450828;116.45713476868,39.929333450828;116.45709883646,39.929333450828;116.45709883646,39.929312702403;116.45708985341,39.928814738298;116.45708087035,39.928724827724;116.45700900591,39.928641833242;116.45689222619,39.928655665662;116.45676646342,39.928662581872;116.45662273454,39.928766324927;116.45577832736,39.928849319257;116.45540103905,39.928883900198;116.45482612352,39.928932313486;116.45447578437,39.928973810562;116.45360442803,39.929056804638;116.45314629222,39.929105217803;116.45275103779,39.929146714774;116.45271510557,39.92924354094;116.45269713946,39.929430276728;116.45269713946,39.9294717735;116.45268815641,39.929644676444;116.45267917335,39.930011229229;116.45267917335,39.930121886284;116.45267917335,39.93022562711;116.45267917335,39.93028787153;116.45267917335,39.930433108287;116.45267917335,39.930785824832;116.45268815641,39.931193867177;116.45268815641,39.931352933868;116.45267917335,39.931719477432;116.45267917335,39.932120598311;116.45267917335,39.932251999463;116.45267917335,39.932307326188;116.45267917335,39.932701527797;116.45261629197,39.932957411827;116.45256239364,39.933068064082;116.4525084953,39.933137221649;116.45204137644,39.933559081287;116.45202341033,39.93359365983;116.45197849505,39.933725058131;116.45193357978,39.934001685303;116.45196052894,39.934195323652;116.45199646116,39.9344027927;116.4520683256,39.934395877075;116.45213120699,39.9344027927;116.45216713921,39.934458117672;116.45216713921,39.9345134426;116.45218510532,39.934561851874;116.45240069864,39.934817728893;116.45244561392,39.934866137951;116.45298459722,39.935488537043;116.45277798696,39.93565450917;116.4525084953,39.936014114055;116.45243663086,39.936173169454;116.45239171559,39.936380632458',\n",
       "       'start_location': {'lng': 116.45842832862, 'lat': 39.928662581872},\n",
       "       'end_location': {'lng': 116.45255341058, 'lat': 39.936401378723}}]],\n",
       "    'traffic_condition': 1},\n",
       "   {'distance': 19546,\n",
       "    'duration': 5686,\n",
       "    'price': 7,\n",
       "    'line_price': [{'line_price': 5, 'line_type': 1},\n",
       "     {'line_price': 2, 'line_type': 0}],\n",
       "    'steps': [[{'distance': 1159,\n",
       "       'duration': 989,\n",
       "       'type': 5,\n",
       "       'instruction': '步行1.2公里',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.33996878101,40.011178086743;116.34000471324,40.010542566293;116.34002267935,40.010169540643;116.34006759462,40.009368219334;116.34052573043,40.009375127317;116.3407323407,40.009375127317;116.3409120018,40.009361311351;116.34188217175,40.00933367941;116.34237623978,40.009306047457;116.34248403644,40.009299139467;116.34333742668,40.009312955446;116.34350810472,40.009312955446;116.34360691833,40.009319863435;116.34365183361,40.008249116812;116.34367878277,40.007592844385;116.34369674888,40.007047097208;116.34374166416,40.00614902266;116.34383149471,40.00605921455;116.34394827442,40.00605921455;116.34414590164,40.006066122871;116.34450522384,40.006086847828;116.34456810523,40.006093756145;116.34463996967,40.006107572778;116.34480166466,40.006142114348;116.34494539354,40.006093756145;116.34547539379,40.006114481094;116.34548437685,40.006114481094;116.3454933599,40.00591413966;116.3454933599,40.00591413966;116.34552030907,40.00591413966;116.34580776683,40.00591413966;116.34582573294,40.006301005344;116.3454933599,40.006294097047;116.3454933599,40.006294097047;116.34552030907,40.006294097047',\n",
       "       'start_location': {'lng': 116.33929505188, 'lat': 40.011157363344},\n",
       "       'end_location': {'lng': 116.34552030907, 'lat': 40.006294097047}}],\n",
       "     [{'distance': 4496,\n",
       "       'duration': 420,\n",
       "       'type': 3,\n",
       "       'instruction': '清华东路西口站(C口)乘地铁15号线(俸伯方向)经过3站到奥林匹克公园站',\n",
       "       'vehicle': {'direct_text': '俸伯方向',\n",
       "        'name': '地铁15号线',\n",
       "        'line_id': '6363d7f82d1625bed7b74e6c',\n",
       "        'start_name': '清华东路西口站(C口)',\n",
       "        'end_name': '奥林匹克公园站',\n",
       "        'start_time': '05:42',\n",
       "        'end_time': '23:15',\n",
       "        'stop_num': 3,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.34552030907,40.006294097047;116.35930031559,40.006715501839;116.37555964532,40.007537579048;116.39823287639,40.008504715931',\n",
       "       'start_location': {'lng': 116.34552030907, 'lat': 40.006294097047},\n",
       "       'end_location': {'lng': 116.39823287639, 'lat': 40.008504715931}}],\n",
       "     [{'distance': 281,\n",
       "       'duration': 234,\n",
       "       'type': 5,\n",
       "       'instruction': '站内换乘 步行281米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.39822389334,40.00849780786;116.39823287639,40.008511624002;116.39849338499,40.008511624002;116.39852033415,40.008000424851;116.39872694442,40.008000424851;116.39874491053,40.007793180853;116.39914016496,40.007793180853;116.39925694467,40.007806997139;116.39928389384,40.00736487458;116.39928389384,40.00736487458;116.39926592773,40.007344150014',\n",
       "       'start_location': {'lng': 116.39823287639, 'lat': 40.008504715931},\n",
       "       'end_location': {'lng': 116.39927491078, 'lat': 40.007351058204}}],\n",
       "     [{'distance': 8129,\n",
       "       'duration': 1020,\n",
       "       'type': 3,\n",
       "       'instruction': '奥林匹克公园站乘地铁8号线(中国美术馆方向)经过7站到南锣鼓巷站(E口)',\n",
       "       'vehicle': {'direct_text': '中国美术馆方向',\n",
       "        'name': '地铁8号线',\n",
       "        'line_id': '86147d290c19ca50a2d230ac',\n",
       "        'start_name': '奥林匹克公园站',\n",
       "        'end_name': '南锣鼓巷站',\n",
       "        'start_time': '05:00',\n",
       "        'end_time': '22:35',\n",
       "        'stop_num': 7,\n",
       "        'total_price': 0,\n",
       "        'type': 1,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.39927491078,40.007351058204;116.40002050436,39.996013771386;116.40070321654,39.982477012037;116.40061338599,39.980265543793;116.40061338599,39.974245838234;116.40152067456,39.964098902222;116.40155660678,39.963048179058;116.401592539,39.960974335576;116.4009727082,39.95863081614;116.40023609768,39.95464872137;116.40099965736,39.949387296819;116.40243694618,39.944962129878;116.40280525144,39.940923913284;116.40286813282,39.940647314315;116.40303881087,39.94039837428;116.40329931947,39.940184008518;116.40386525194,39.940087197952;116.41045881438,39.940107943085',\n",
       "       'start_location': {'lng': 116.39927491078, 'lat': 40.007351058204},\n",
       "       'end_location': {'lng': 116.41045881438, 'lat': 39.940107943085}}],\n",
       "     [{'distance': 183,\n",
       "       'duration': 153,\n",
       "       'type': 5,\n",
       "       'instruction': '步行183米',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.41045881438,39.940101028041;116.41044983133,39.940101028041;116.41044983133,39.940101028041;116.40938084777,39.940094112997;116.40938084777,39.940094112997;116.40938084777,39.940094112997;116.40938983083,39.939983472193;116.40938983083,39.939983472193;116.40938983083,39.939928151723;116.40938084777,39.939914321598;116.40941677999,39.939914321598;116.40952457665,39.939845170933;116.40949762749,39.939755274964;116.4096144072,39.939755274964;116.40967728859,39.939748359884',\n",
       "       'start_location': {'lng': 116.41045881438, 'lat': 39.940107943085},\n",
       "       'end_location': {'lng': 116.40967728859, 'lat': 39.939755274964}}],\n",
       "     [{'distance': 3929,\n",
       "       'duration': 797,\n",
       "       'type': 3,\n",
       "       'instruction': '南锣鼓巷站乘4路[原701路](大西洋新城南门方向)或118路经过6站到工人体育场站',\n",
       "       'vehicle': {'direct_text': '大西洋新城南门方向',\n",
       "        'name': '4路[原701路]',\n",
       "        'line_id': 'f96836e493fd1da9c62ba17f',\n",
       "        'start_name': '南锣鼓巷站',\n",
       "        'end_name': '工人体育场站',\n",
       "        'start_time': '05:30',\n",
       "        'end_time': '22:00',\n",
       "        'stop_num': 6,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.40967728859,39.939755274964;116.41151881488,39.939776020198;116.41584864744,39.939630803424;116.4210588194,39.939658463786;116.42360102399,39.939817510648;116.43724628469,39.939637718516;116.43987831983,39.939547822272;116.43997713344,39.939354199187;116.44024662509,39.939202066376;116.44038137092,39.939188236104;116.44103713394,39.939236642045;116.44136052393,39.939492501447;116.44165696474,39.939547822272;116.4553112085,39.939388774778',\n",
       "       'start_location': {'lng': 116.40967728859, 'lat': 39.939755274964},\n",
       "       'end_location': {'lng': 116.4553112085, 'lat': 39.939388774778}},\n",
       "      {'distance': 3954,\n",
       "       'duration': 816,\n",
       "       'type': 3,\n",
       "       'instruction': '',\n",
       "       'vehicle': {'direct_text': '红庙路口东方向',\n",
       "        'name': '118路',\n",
       "        'line_id': 'cc33fab7bf2e12b5b04c49b7',\n",
       "        'start_name': '南锣鼓巷站',\n",
       "        'end_name': '工人体育场站',\n",
       "        'start_time': '05:00',\n",
       "        'end_time': '23:00',\n",
       "        'stop_num': 7,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '',\n",
       "       'start_location': {'lng': 116.40985694969, 'lat': 39.939755274964},\n",
       "       'end_location': {'lng': 116.45578731042, 'lat': 39.939388774778}}],\n",
       "     [{'distance': 1369,\n",
       "       'duration': 1173,\n",
       "       'type': 5,\n",
       "       'instruction': '步行1.4公里',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.4553112085,39.939312708454;116.45442188604,39.939326538701;116.45427815716,39.939326538701;116.45389188579,39.939319623578;116.45348764831,39.939326538701;116.45262527502,39.939340368946;116.45254442753,39.939340368946;116.45218510532,39.939340368946;116.45186171534,39.939347284067;116.45137663036,39.939354199187;116.45117002009,39.939354199187;116.45037052819,39.939361114307;116.45037052819,39.939188236104;116.45036154514,39.938814817683;116.45035256208,39.937770618233;116.45034357903,39.936767895036;116.45034357903,39.936684910384;116.45033459597,39.936069437714;116.45033459597,39.935301817914;116.45033459597,39.934465033291;116.45052324013,39.934471948908;116.45071188428,39.934471948908;116.45081968095,39.934465033291;116.45114307093,39.934451202053;116.4513496812,39.934444286433;116.45194256283,39.9344027927;116.45199646116,39.9344027927;116.4520683256,39.934395877075;116.45213120699,39.9344027927;116.45216713921,39.934458117672;116.45216713921,39.9345134426;116.45218510532,39.934561851874;116.45240069864,39.934817728893;116.45244561392,39.934866137951;116.45298459722,39.935488537043;116.45277798696,39.93565450917;116.4525084953,39.936014114055;116.45243663086,39.936173169454;116.45239171559,39.936380632458',\n",
       "       'start_location': {'lng': 116.4553112085, 'lat': 39.939388774778},\n",
       "       'end_location': {'lng': 116.45255341058, 'lat': 39.936401378723}}]],\n",
       "    'traffic_condition': 1},\n",
       "   {'distance': 19806,\n",
       "    'duration': 6933,\n",
       "    'price': 5,\n",
       "    'line_price': [{'line_price': 0, 'line_type': 1},\n",
       "     {'line_price': 5, 'line_type': 0}],\n",
       "    'steps': [[{'distance': 1442,\n",
       "       'duration': 1236,\n",
       "       'type': 5,\n",
       "       'instruction': '步行1.4公里',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.33996878101,40.011178086743;116.34000471324,40.010542566293;116.34002267935,40.010169540643;116.34006759462,40.009368219334;116.34052573043,40.009375127317;116.3407323407,40.009375127317;116.3409120018,40.009361311351;116.34188217175,40.00933367941;116.34237623978,40.009306047457;116.34248403644,40.009299139467;116.34333742668,40.009312955446;116.34350810472,40.009312955446;116.34360691833,40.009319863435;116.34365183361,40.008249116812;116.34367878277,40.007592844385;116.34369674888,40.007047097208;116.34374166416,40.00614902266;116.34383149471,40.00605921455;116.34394827442,40.00605921455;116.34414590164,40.006066122871;116.34450522384,40.006086847828;116.34456810523,40.006093756145;116.34463996967,40.006107572778;116.34480166466,40.006142114348;116.34494539354,40.006093756145;116.34548437685,40.006114481094;116.34566403795,40.006114481094;116.34583471599,40.006121389408;116.34586166516,40.006128297722;116.34642759763,40.006155930971;116.34653539429,40.006259555555;116.34665217401,40.006259555555;116.34691268261,40.006259555555;116.3472540387,40.006259555555;116.34774810673,40.00628718875;116.34900573445,40.006328638522;116.34952675164,40.006349363399;116.35008370106,40.00635627169;116.35053285381,40.006370088269',\n",
       "       'start_location': {'lng': 116.33929505188, 'lat': 40.011157363344},\n",
       "       'end_location': {'lng': 116.35053285381, 'lat': 40.00636317998}}],\n",
       "     [{'distance': 6869,\n",
       "       'duration': 1473,\n",
       "       'type': 3,\n",
       "       'instruction': '北京林业大学站乘450路(来广营北方向)经过10站到炎黄艺术馆站',\n",
       "       'vehicle': {'direct_text': '来广营北方向',\n",
       "        'name': '450路',\n",
       "        'line_id': '26badebe6dc9ee20ca1b95c3',\n",
       "        'start_name': '北京林业大学站',\n",
       "        'end_name': '炎黄艺术馆站',\n",
       "        'start_time': '05:30',\n",
       "        'end_time': '21:30',\n",
       "        'stop_num': 10,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.35053285381,40.00636317998;116.36366608037,40.006853666773;116.38713880334,40.008007332974;116.38835151578,40.00805568981;116.38853117688,40.007986608604;116.39085778815,40.008062597927;116.39431626437,40.008235300616;116.40292203115,40.008504715931;116.4031735567,40.006349363399;116.40364965862,40.004428831239;116.4070542365,40.00451864151;116.40721593149,40.004532458465;116.40700932122,40.008663601384;116.41095288241,40.008739589947;116.41110559435,40.00875340604;116.41122237407,40.00883630254;116.41416881614,40.008905382879;116.41407000253,40.003862332935',\n",
       "       'start_location': {'lng': 116.35053285381, 'lat': 40.00636317998},\n",
       "       'end_location': {'lng': 116.41407000253, 'lat': 40.003862332935}}],\n",
       "     [{'distance': 10,\n",
       "       'duration': 8,\n",
       "       'type': 5,\n",
       "       'instruction': '同站换乘',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.41394423976,40.003862332935;116.41394423976,40.003945235421;116.41394423976,40.003952143957',\n",
       "       'start_location': {'lng': 116.41407000253, 'lat': 40.003862332935},\n",
       "       'end_location': {'lng': 116.41407000253, 'lat': 40.003945235421}}],\n",
       "     [{'distance': 10455,\n",
       "       'duration': 2134,\n",
       "       'type': 3,\n",
       "       'instruction': '炎黄艺术馆站乘406路[原特16路](单店方向)经过16站到工人体育馆站',\n",
       "       'vehicle': {'direct_text': '单店方向',\n",
       "        'name': '406路[原特16路]',\n",
       "        'line_id': '05d7b133150d9394b8bd6355',\n",
       "        'start_name': '炎黄艺术馆站',\n",
       "        'end_name': '工人体育馆站',\n",
       "        'start_time': '05:30',\n",
       "        'end_time': '22:00',\n",
       "        'stop_num': 16,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.41407000253,40.003945235421;116.41386339227,39.99381656397;116.41370169727,39.993685282026;116.41350407006,39.993671462859;116.41335135812,39.99372673951;116.41280339176,39.99414131295;116.41267762899,39.994307141616;116.41270457816,39.994452241365;116.4128752562,39.994542064864;116.41404305337,39.994542064864;116.41593847799,39.994652616699;116.43045509503,39.994818444114;116.43105695973,39.9824424584;116.43126356999,39.976353832681;116.43126356999,39.974805672659;116.4315420447,39.966746375912;116.43153306165,39.964506744328;116.43173068886,39.955851670469;116.43187441774,39.955526738045;116.43233255355,39.941193596193;116.43225170605,39.939713784476;116.4398244215,39.939589312861;116.43996815039,39.939361114307;116.44015679454,39.939215896646;116.44091137117,39.93916057555;116.44119882893,39.939264302567;116.44141442226,39.939568567569;116.44952612101,39.939471756126',\n",
       "       'start_location': {'lng': 116.41407000253, 'lat': 40.003945235421},\n",
       "       'end_location': {'lng': 116.44952612101, 'lat': 39.939471756126}}],\n",
       "     [{'distance': 1030,\n",
       "       'duration': 882,\n",
       "       'type': 5,\n",
       "       'instruction': '步行1.0公里',\n",
       "       'vehicle': {'direct_text': '',\n",
       "        'name': '',\n",
       "        'line_id': '',\n",
       "        'start_name': '',\n",
       "        'end_name': '',\n",
       "        'start_time': '',\n",
       "        'end_time': '',\n",
       "        'stop_num': 0,\n",
       "        'total_price': 0,\n",
       "        'type': 0,\n",
       "        'zone_price': 0},\n",
       "       'path': '116.44952612101,39.939457925908;116.45004713821,39.939451010798;116.45026273153,39.939444095688;116.45037052819,39.939444095688;116.45037052819,39.939361114307;116.45037052819,39.939188236104;116.45036154514,39.938814817683;116.45035256208,39.937770618233;116.45034357903,39.936767895036;116.45034357903,39.936684910384;116.45033459597,39.936069437714;116.45033459597,39.935301817914;116.45033459597,39.934465033291;116.45052324013,39.934471948908;116.45071188428,39.934471948908;116.45081968095,39.934465033291;116.45114307093,39.934451202053;116.4513496812,39.934444286433;116.45194256283,39.9344027927;116.45199646116,39.9344027927;116.4520683256,39.934395877075;116.45213120699,39.9344027927;116.45216713921,39.934458117672;116.45216713921,39.9345134426;116.45218510532,39.934561851874;116.45240069864,39.934817728893;116.45244561392,39.934866137951;116.45298459722,39.935488537043;116.45277798696,39.93565450917;116.4525084953,39.936014114055;116.45243663086,39.936173169454;116.45239171559,39.936380632458',\n",
       "       'start_location': {'lng': 116.44952612101, 'lat': 39.939471756126},\n",
       "       'end_location': {'lng': 116.45255341058, 'lat': 39.936401378723}}]],\n",
       "    'traffic_condition': 1}],\n",
       "  'taxi': {'detail': [{'desc': '白天(05:00-23:00)',\n",
       "     'km_price': 2.3,\n",
       "     'start_price': 14,\n",
       "     'total_price': 51},\n",
       "    {'desc': '夜间(23:00-05:00)',\n",
       "     'km_price': 2.8,\n",
       "     'start_price': 14,\n",
       "     'total_price': 58}],\n",
       "   'distance': 17494,\n",
       "   'duration': 1724,\n",
       "   'remark': '全程17.5公里;3.0公里起步；燃油附加费0.0元；里程超过15.0公里，超过部分每公里收4.1元。'}}}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 3、上车点"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "#上车点\n",
    "\n",
    "url = f'http://api.map.baidu.com/parking/search?location=120.11614538041329,30.294761455511946&coordtype=bd09ll&ak={AK}'\n",
    "data2 = requests.get(url)\n",
    "\n",
    "num = len(json.loads(json.loads(json.dumps(data2.text, ensure_ascii=False)))['recommendStops'])\n",
    "\n",
    "\n",
    "data2 =json.loads(json.loads(json.dumps(data2.text, ensure_ascii=False)))['recommendStops']\n",
    "\n",
    "\n",
    "shangche = []\n",
    "\n",
    "for i in range(num):\n",
    "    \n",
    "    shangche.append(data2[i]['name'])\n",
    "\n",
    "    \n",
    "shangche = '、'.join(shangche)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{'name': '益乐新村北区-南1门',\n",
       "  'address': '',\n",
       "  'distance': 173.51348876953,\n",
       "  'bd09ll_x': 120.11534921223978,\n",
       "  'bd09ll_y': 30.29335633925444,\n",
       "  'gcj02ll_x': 120.10891310104522,\n",
       "  'gcj02ll_y': 30.287052696697216,\n",
       "  'id': '63bf6a4b8ba88603d4b74ea0'},\n",
       " {'name': '西斗门路丰潭路口-公交站-路北附近',\n",
       "  'address': '',\n",
       "  'distance': 206.71768188477,\n",
       "  'bd09ll_x': 120.1147922628236,\n",
       "  'bd09ll_y': 30.296209583345718,\n",
       "  'gcj02ll_x': 120.1083570755251,\n",
       "  'gcj02ll_y': 30.289912468862674,\n",
       "  'id': '3e3678e155dfe281ae080fe6'},\n",
       " {'name': '中国美术学院风景建筑设计研究总院有限公司停车场-入口',\n",
       "  'address': '',\n",
       "  'distance': 250.67141723633,\n",
       "  'bd09ll_x': 120.11799023043912,\n",
       "  'bd09ll_y': 30.296349904662318,\n",
       "  'gcj02ll_x': 120.11156284172019,\n",
       "  'gcj02ll_y': 30.290022384119958,\n",
       "  'id': 'b62370ff73be90c579b55cc9'}]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 喵提醒发送至微信"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 请务必申请一个喵提醒ID，[点击直达教程地址](https://mp.weixin.qq.com/s?__biz=MzIxNjQ1NzU2Mw==&mid=100000042&idx=6&sn=c9656c8b242972f62fe5840ddf7487db&scene=19#wechat_redirect)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "哈喽，冰冰，早上好!\n",
      "\n",
      "今天是2021年02月13日，星期六，辛丑年正月初二。\n",
      "\n",
      "现在已经07:52:42啦，距离上班还有97分钟。\n",
      "\n",
      "外面的天气情况不是很好，阴8 ~ 16℃，空气质量：优，记得带伞哦～\n",
      "\n",
      "根据现在的路况，路况畅通，总共17.492千米，打车去公司需要29分钟，坐公交地铁的话需要89分钟。\n",
      "\n",
      "如果需要打车去公司的话，最近的上车点为益乐新村北区-南1门、西斗门路丰潭路口-公交站-路北附近、中国美术学院风景建筑设计研究总院有限公司停车场-入口。\n",
      "\n",
      "加油，打工人，再上一天班就放假咯！\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "text = f\"\"\"\n",
    "\n",
    "哈喽，冰冰，早上好!\n",
    "\n",
    "今天是{date}。\n",
    "\n",
    "现在已经{time_now}啦，距离上班还有{time3}分钟。\n",
    "\n",
    "外面的天气情况不是很好，{weather}，{air}，记得带伞哦～\n",
    "\n",
    "根据现在的路况，路况{lukuang}，总共{distance}千米，打车去公司需要{time_cost}分钟，坐公交地铁的话需要{time_cost1}分钟。\n",
    "\n",
    "如果需要打车去公司的话，最近的上车点为{shangche}。\n",
    "\n",
    "加油，打工人，再上一天班就放假咯！\n",
    "\n",
    "\"\"\"\n",
    "print(text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "Reminder message was sent successfully\n"
     ]
    }
   ],
   "source": [
    "your_id = \"替换成你申请的ID\"\n",
    "class Message(object):\n",
    "    def __init__(self,text):\n",
    "        self.text = text\n",
    "    def push(self):\n",
    "        # id 为相应提醒的喵码\n",
    "        page = request.urlopen(\"http://miaotixing.com/trigger?\" + parse.urlencode({\"id\": your_id, \"text\": self.text, \"type\": \"json\"}))\n",
    "        result = page.read()\n",
    "        jsonObj = json.loads(result)\n",
    "        if (jsonObj[\"code\"] == 0):\n",
    "            print(\"\\nReminder message was sent successfully\")\n",
    "        else:\n",
    "            print(\"\\nReminder message failed to be sent，wrong code：\" + str(jsonObj[\"code\"]) + \"，describe：\" + jsonObj[\"msg\"])\n",
    "\n",
    "\n",
    "message = Message(text)\n",
    "message.push() # 完成推送"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
